<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<!--
        猜数字小游戏

-->

<script>

    var random = parseInt(Math.random() * 100)  // [0 10)
    do {
        var number = window.prompt("请输入一个数字")
        if (number > random) {
            alert("数字猜大了")
        } else if (number < random) {
            alert("数字猜小了")
        } else {
            alert("恭喜你，猜对了")
        }
    } while (number != random)


</script>
</body>
</html>